#ifndef __CAN_H
#define __CAN_H

#ifdef __cplusplus
extern "C"
{
#endif

#include "gd32f10x.h"
#include "gd32f10x_libopt.h"

/* select CAN baudrate */
/* 1MBps */
#define CAN_BAUDRATE  1000
/* 500kBps */
/* #define CAN_BAUDRATE  500 */
/* 250kBps */
/* #define CAN_BAUDRATE  250 */
/* 125kBps */
/* #define CAN_BAUDRATE  125 */
/* 100kBps */ 
/* #define CAN_BAUDRATE  100 */
/* 50kBps */ 
/* #define CAN_BAUDRATE  50 */
/* 20kBps */ 
/* #define CAN_BAUDRATE  20 */

extern FlagStatus can0_receive_flag;
extern FlagStatus can0_error_flag;
extern can_parameter_struct can_init_parameter;
extern can_filter_parameter_struct can_filter_parameter;
extern can_trasnmit_message_struct g_transmit_message;
extern can_receive_message_struct g_receive_message;

void can_config(can_parameter_struct can_parameter, can_filter_parameter_struct can_filter);
#ifdef __cplusplus
}
#endif

#endif
